/**
 * 
 */
package com.hanhai.zrb.api.biz.dao.mybatis;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import com.hanhai.zrb.api.biz.dao.mybatis.base.BaseMapper;
import com.hanhai.zrb.model.userDynamic.UserDynamic;
import com.hanhai.zrb.model.userDynamic.dto.UserDynamicDto;

/**
 * @author leiruiqi@hanhai.com
 *
 */
public interface UserDynamicMapper extends BaseMapper{

	@Insert("insert into user_dynamic (user_id,	create_time,type,target,title,extra ) values( #{userId},NOW(),#{type},#{target},#{title},#{extra} )")
	void create(UserDynamic userDynamic);
	
	@ResultMap("userDynamicResultMap")
	@Select("select id,user_id,create_time,type,target,title,extra from user_dynamic as a where user_id=#{userId} order by create_time desc")
	List<UserDynamic> queryAllByUserId(Long userId);
	
	/**
	 * 条件查询，sql见 UserDynamicMapper.xml文件
	 * @param dto
	 * @return
	 */
	List<UserDynamic> queryByDto(UserDynamicDto dto);
	
	void deleteDynamic(@Param("ids") List<Long> ids);
}
